package com.ship.control.search;

import com.ship.enume.UserType;

/**
 * 人员
 * @author wqf
 * @version  Nov 24, 2011 11:55:45 AM
 */
public class UserSearchCond extends SearchCond{
	
	private String name;
	
	private UserType userType;
	
	public String getName() {
		return name;
	}

	public UserType getUserType() {
		return userType;
	}

	public void setUserType(UserType userType) {
		this.userType = userType;
	}

	public void setName(String name) {
		this.name = name;
	}

	public ConditionPart getCondition(){
		ConditionPart cp=new ConditionPart();
		StringBuffer searchStr=new StringBuffer(" 1=1");
		
		if(null!=this.userType){
			searchStr.append(" and userType=?");
			cp.getParams().add(userType);
		}
		if(null!=name){
			searchStr.append(" and name like ?");
			cp.getParams().add("%"+name+"%");
		}
		
		cp.setExpression(searchStr.toString());
		return cp;
	}

}
